<template>
	<view class="collection-list">
		<uni-list>
			<uni-list-item :title="item.name" :note="'¥'+item.price" 
			v-for="item in collectionList" :key="item.id"
			:to="'/pages/goods/detail/detail?id='+item.goods_id">
				<template v-slot:header>
					<view class="uni-thumb">
						<image :src="item.img_md" mode="aspectFill" class="img"></image>
					</view>
				</template>
			</uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import {
		getCollection
	} from '@/config/api.js'
	export default {
		data() {
			return {
				collectionList:[]
			};
		},
		mounted() {
			getCollection().then(res=>{
				this.collectionList = res.data
			})
		}
	}
</script>

<style lang="scss">
.collection-list{
	.img{
		width: 200rpx;
		height: 200rpx;
		margin-right: 20rpx;
	}
}
</style>
